<?php

namespace App\Services;

use App\Models\WxReply;

class WxReplyService extends ServiceBase
{
    public function getTextReply($appid, $keyword)
    {
        return WxReply::where('appid', $appid)->where('receive_msg_type', 'text')->where('receive_content', $keyword)->first();
    }

    public function getCommonReply($appid)
    {
        return WxReply::where('appid', $appid)->where('receive_msg_type', 'common')->first();
    }

    public function getEventReply($appid, $event, $event_key = 'default')
    {
        return WxReply::where('appid', $appid)->where('event', $event)->where('event_key', $event_key)->first();
    }
}
